<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: pi_clickandbuy_mms.php 91 2013-09-21 12:04:35Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 91 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 12:04:35 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright © since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	© 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	© 2002-2003 osCommerce - www.oscommerce.com
* 	© 2003     nextcommerce - www.nextcommerce.org
* 	© 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2, as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * @category  PayIntelligent
 * @package   PayIntelligent_ClickandBuy
 * @copyright (C) 2010 PayIntelligent GmbH  <http://www.payintelligent.de/>
 * @license   GPLv2
 */

require_once('includes/application_top.php');
include('../lang/'.$_SESSION['language'].'/admin/pi_clickandbuy.php');

require(DIR_FS_CATALOG.DIR_WS_CLASSES.'class.clickandbuy.php');
$cab = new clickandbuy();	

$shopOrderID = $_GET['oID'];

$mmsList = array();
$i = 0;

$row = $db->db_query("SELECT externalID FROM ".DB_PREFIX."picab_orders WHERE shopOrderID ='".$shopOrderID."'");

$externalID = $row->fields['externalID'];

$row = $db->db_query("SELECT * FROM ".DB_PREFIX."picab_mms WHERE shopOrderID ='".$shopOrderID."' OR externalID ='".$externalID."' ORDER BY eventID");

while (!$row->EOF) {
	$mmsList[$i] = $row->fields;			
	$i++;
	$row->MoveNext();
}	
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
	<tr>
		<td>	
			<table border="0" width="100%" cellspacing="0" cellpadding="2" height="40">
				<tr>
					<td class="pageHeading"><?php echo CLICKANDBUY_ORDER_CLICKANDBUY.' '.CLICKANDBUY_ORDER_MMS; ?></td>
					<td class="pageHeading" align="right">
						<a class="button cab_button" href="pi_clickandbuy_details.php?oID=<?php echo $shopOrderID; ?>">
							<?php echo CLICKANDBUY_ORDER_DETAILS_BACK; ?>
						</a>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table border="0" width="100%" cellspacing="0" cellpadding="2">
				<tr>
					<td>
					<?php if (empty($mmsList)) { ?>
						<p><?php echo CLICKANDBUY_ORDER_NO_ENTRIES; ?></p>
					<?php } else { ?>
						<table cellspacing="0" cellpadding="5" border="0" width="100%">
							<tr>
								<td class="infoBoxHeading" width="15%"><?php echo CLICKANDBUY_ORDER_MMS_EVENTID; ?></td>
								<td class="infoBoxHeading"><?php echo CLICKANDBUY_ORDER_DETAILS_TRANSACTIONID; ?></td>
								<td class="infoBoxHeading" width="15%"><?php echo CLICKANDBUY_ORDER_DETAILS_EXTERNALID; ?></th>
									<td class="infoBoxHeading" width="15%"><?php echo CLICKANDBUY_ORDER_MMS_STATE_OLD; ?></td>
									<td class="infoBoxHeading" width="15%"><?php echo CLICKANDBUY_ORDER_MMS_STATE_NEW; ?></td>
									<td class="infoBoxHeading" width="15%"><?php echo CLICKANDBUY_ORDER_MMS_XML; ?></td>
									<td class="infoBoxHeading" width="15%"><?php echo CLICKANDBUY_ORDER_DETAILS_DATE_TIME; ?></td>
								</tr>								
								<?php foreach ($mmsList as $item => $value) { ?>
								<tr>
									<td class="infoBoxContent" valign="top" width="15%"> <?php echo $value['eventID']; ?></td>
									<td class="infoBoxContent" valign="top"> <?php echo $value['transactionID']; ?></td>
									<td class="infoBoxContent" valign="top" width="15%"> <?php echo $value['externalID']; ?></td>
									<td class="infoBoxContent" valign="top" width="15%"> <?php echo $value['oldState']; ?></td>
									<td class="infoBoxContent" valign="top" width="15%"> <?php echo $value['newState']; ?></td>
									<td class="infoBoxContent" valign="top" width="15%"> 
										<div id="infoBoxMMS">
											<a href="#">
												<img src="images/icon_info.gif" border="0" alt="" title="">
												<span>
													<textarea class="infoBox" readonly cols="60" rows="20">
													<?php echo $value['xml']; ?></textarea><br />
												</span>
											</a>
										</div>								
									</td>
									<td class="infoBoxContent" valign="top" width="15%"> <?php echo $value['created']; ?></td>
								</tr>
						<?php }	?>
						</table>
					<?php } ?>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>		